#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}




void MainWindow::on_pushButton_clicked()
{
   QMessageBox* messageBox = new QMessageBox(this);
   messageBox->setWindowTitle("对话框窗口标题");
   messageBox->setText("这是对话框的文本");

   messageBox->setIcon(QMessageBox::Warning);

   messageBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Save | QMessageBox::No);

   int result = messageBox->exec();

   if(result == QMessageBox::Ok)
   {
       qDebug() << "Ok";
   }
   else if(result == QMessageBox::Save)
   {

       qDebug() << "Save";
   }
   else if (result == QMessageBox::No)
   {
       qDebug() << "No";
   }

   delete messageBox;
}
